version 14.0

log using "\Users\sgolder\Dropbox\Portfolio Allocation\replication\figure1.log", replace

set more off
#delimit ;

*     ***************************************************************** *;
*     ***************************************************************** *;
*       File-Name:      africancabinets_figure1.do                      *;
*       Date:           September 28, 2016                              *;
*       Author:         Molly Ariotti and Sona Golder                   *;
*       Purpose:      	Produce Figure 1 for CPS African portfolio      *;
*                       allocation paper.                               *;
* 	    Input File:     Europe.dta                                      *;
*       Output File:    figure1.log, europe.eps                         *;
*       Data Output:    none                                            *;             
*       Previous file:  none                                            *;
*       Machine:        laptop                           				*;
*     ****************************************************************  *;
*     ****************************************************************  *;

use "C:\Users\sgolder\Dropbox\Portfolio Allocation\replication\Europe.dta";

sum;

*     ****************************************************************  *;
*       Drop European cabinets where there is no formateur coded.       *;
*      (These are caseno 531, 532, 533, 534, 542,543, 617, 858, 859)    *;
*     ****************************************************************  *;

drop if code == 205097;
drop if code == 205098;
drop if code == 205099;
drop if code == 205100;
drop if code == 205108;
drop if code == 205109;
drop if code == 207130;
drop if code == 209184;
drop if code == 209185;


*     ****************************************************************  *;
*       Number of cabinet parties and coalition governments.            *;
*     ****************************************************************  *;

sum;
sum year if formateur==1;

*     ****************************************************************  *;
*       Create perfect proportionality data                             *;
*     ****************************************************************  *;

gen seats=.;
replace seats=_n/100 if _n<101;
gen ports=.;
replace ports=_n/100 if _n<101;

*     ****************************************************************  *;
*       Produce Figure 1                                                *;
*     ****************************************************************  *;

scatter portfolioshare seatshare if formateur==1, msymbol(O) mcolor(red) msize(medsmall) 
        || scatter portfolioshare seatshare if formateur==0, msymbol(Oh) mcolor(eltblue) msize(medsmall) 
        || line ports seats if seatshare>0 , lcolor(black) clpattern(solid) 
        legend(col(1) size(2.5) region(lstyle(color(white))) order(1 2) position(5) ring(0) label(1 "{stSerif:Formateur Party}") label(2 "{stSerif:Not a Formateur Party}"))
        ||,
        xtitle("{stSerif:Share of Government's Legislative Seats}", size(3) height(7)) 
        ytitle("{stSerif:Share of Cabinet Portfolios}" , size(3) height(7))
        xlabel(0 0.2 0.4 0.6 0.8 1.0, nogrid labsize(2.5))
        ylabel(0 0.2 0.4 0.6 0.8 1.0, nogrid labsize(2.5)) 
        scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white)); 

graph export "C:\Users\sgolder\Dropbox\Portfolio Allocation\replication\europe.eps", replace;


log close;
exit;
